<?php
namespace app\controller;

use app\controller\HomeBase;

class Mobile extends HomeBase
{
    public function SendCode(){

        
        $param['mobile'] = request()->param('mobile');
        $param['type'] = request()->param('type',1,'intval');
        //p( $param);
        try {
            $re=$this->validate($param,'app\validate\Mobile');
         } catch (\Exception $e) {       
             return json(['status'=>0,'msg'=>$e->error,'data'=>[]]);
         }
        //  $users=$this->userModel->GetUserByMobile(trim($param['mobile']));
        //  if(empty($users)){
        //      return json(['status'=>0,'msg'=>'用户不存在','data'=>[]]);
        //  }
        $result = $this->getBusiness('Mobile')->sendSms($param);
        if($result['status']==1){
            return json(['status'=>1,'msg'=>'发送成功','data'=>[]]);
        }else{
            return json(['status'=>0,'msg'=>$result['msg'],'data'=>[]]);
        }
    }
}